home *** CD-ROM | disk | FTP | other *** search
/ Merciful 2 / Merciful - Disc 2.iso / software / m / maxonc++2.dms / maxonc++2.adf / MCPIncl.lha / libraries / commodities.h < prev    next >
C/C++ Source or Header  |  1992-01-26  |  7KB  |  210 lines

  1. #ifndef LIBRARIES_COMMODITIES_H
  2. #define LIBRARIES_COMMODITIES_H
  3.  
  4. /*
  5. **   $Filename: libraries/commodities.h $
  6. **   $Release: 2.04 $
  7. **   $Revision: 36.1 $
  8. **   $Date: 90/05/01 $
  9. **
  10. **   Commodities definitions.
  11. **
  12. **   (C) Copyright 1988,1989,1990 Commodore-Amiga Inc.
  13. **    All Rights Reserved
  14. */
  15.  
  16. #ifndef EXEC_TYPES_H
  17. #include <exec/types.h>
  18. #endif
  19.  
  20. /*************************
  21.  * object creation macros
  22.  *************************/
  23. #define CxFilter(d)        CreateCxObj((LONG)CX_FILTER, (LONG) d, 0)
  24. #define CxTypeFilter(type)  CreateCxObj((LONG)CX_TYPEFILTER, (LONG) type, 0)
  25. #define CxSender(port,id)   CreateCxObj((LONG)CX_SEND, (LONG) port, (LONG) id)
  26. #define CxSignal(task,sig)  CreateCxObj((LONG)CX_SIGNAL,(LONG) task, (LONG) sig)
  27. #define CxTranslate(ie)     CreateCxObj((LONG)CX_TRANSLATE, (LONG) ie, 0)
  28. #define CxDebug(id)        CreateCxObj((LONG)CX_DEBUG, (LONG) id, 0)
  29. #define CxCustom(action,id) CreateCxObj((LONG)CX_CUSTOM,(LONG)action,(LONG)id)
  30.  
  31. /***************
  32.  * Broker stuff
  33.  ***************/
  34.  
  35. /* buffer sizes   */
  36. #define CBD_NAMELEN    24
  37. #define CBD_TITLELEN    40
  38. #define CBD_DESCRLEN    40
  39.  
  40. /* CxBroker errors   */
  41. #define CBERR_OK    0     /* No error                 */
  42. #define CBERR_SYSERR    1     /* System error , no memory, etc    */
  43. #define CBERR_DUP    2     /* uniqueness violation         */
  44. #define CBERR_VERSION    3     /* didn't understand nb_VERSION     */
  45.  
  46. #define NB_VERSION    5     /* Version of NewBroker structure   */
  47.  
  48. struct NewBroker {
  49.    BYTE     nb_Version;     /* set to NB_VERSION             */
  50.    BYTE     *nb_Name;
  51.    BYTE     *nb_Title;
  52.    BYTE     *nb_Descr;
  53.    SHORT    nb_Unique;
  54.    SHORT    nb_Flags;
  55.    BYTE     nb_Pri;
  56.    /* new in V5   */
  57.    struct MsgPort   *nb_Port;
  58.    WORD     nb_ReservedChannel;  /* plans for later port sharing     */
  59. };
  60.  
  61. /* Flags for nb_Unique */
  62. #define NBU_DUPLICATE    0
  63. #define NBU_UNIQUE    1     /* will not allow duplicates         */
  64. #define NBU_NOTIFY    2     /* sends CXM_UNIQUE to existing broker */
  65.  
  66. /* Flags for nb_Flags */
  67. #define   COF_SHOW_HIDE 4
  68.  
  69. /********
  70.  * cxusr
  71.  ********/
  72.  
  73. /** Fake data types for system private objects     */
  74. #ifndef CX_H
  75. typedef LONG   CxObj;
  76. typedef LONG   CxMsg;
  77. #endif
  78.  
  79. /* Pointer to Function returning Long    */
  80. typedef LONG   (*PFL)();
  81.  
  82. /********************************/
  83. /** Commodities Object Types   **/
  84. /********************************/
  85. #define CX_INVALID    0     /* not a valid object (probably null)  */
  86. #define CX_FILTER    1     /* input event messages only         */
  87. #define CX_TYPEFILTER    2     /* filter on message type         */
  88. #define CX_SEND    3     /* sends a message             */
  89. #define CX_SIGNAL    4     /* sends a signal             */
  90. #define CX_TRANSLATE    5     /* translates IE into chain         */
  91. #define CX_BROKER    6     /* application representative         */
  92. #define CX_DEBUG    7     /* dumps kprintf to serial port         */
  93. #define CX_CUSTOM    8     /* application provids function         */
  94. #define CX_ZERO    9     /* system terminator node         */
  95.  
  96. /*****************/
  97. /** CxMsg types **/
  98. /*****************/
  99. #define CXM_UNIQUE   (1 << 4) /* sent down broker by CxBroker()      */
  100. /* Obsolete: subsumed by CXM_COMMAND (below)   */
  101.  
  102. /* Messages of this type rattle around the Commodities input network.
  103.  * They will be sent to you by a Sender object, and passed to you
  104.  * as a synchronous function call by a Custom object.
  105.  *
  106.  * The message port or function entry point is stored in the object,
  107.  * and the ID field of the message will be set to what you arrange
  108.  * issuing object.
  109.  *
  110.  * The Data field will point to the input event triggering the
  111.  * message.
  112.  */
  113. #define CXM_IEVENT   (1 << 5)
  114.  
  115. /* These messages are sent to a port attached to your Broker.
  116.  * They are sent to you when the controller program wants your
  117.  * program to do something.  The ID field identifies the command.
  118.  *
  119.  * The Data field will be used later.
  120.  */
  121. #define CXM_COMMAND   (1 << 6)
  122.  
  123. /* ID values   */
  124. #define CXCMD_DISABLE    (15)  /* please disable yourself       */
  125. #define CXCMD_ENABLE    (17)  /* please enable yourself        */
  126. #define CXCMD_APPEAR    (19)  /* open your window, if you can  */
  127. #define CXCMD_DISAPPEAR (21)  /* go dormant               */
  128. #define CXCMD_KILL    (23)  /* go away for good           */
  129. #define CXCMD_UNIQUE    (25)  /* someone tried to create a broker
  130.                    * with your name.  Suggest you Appear.
  131.                    */
  132. #define CXCMD_LIST_CHG    (27)  /* Used by Exchange program. Someone */
  133.                   /* has changed the broker list       */
  134.  
  135. /* return values for BrokerCommand(): */
  136. #define CMDE_OK    (0)
  137. #define CMDE_NOBROKER    (-1)
  138. #define CMDE_NOPORT    (-2)
  139. #define CMDE_NOMEM    (-3)
  140.  
  141. /* IMPORTANT NOTE: for V5:
  142.  * Only CXM_IEVENT messages are passed through the input network.
  143.  *
  144.  * Other types of messages are sent to an optional port in your broker.
  145.  *
  146.  * This means that you must test the message type in your message handling,
  147.  * if input messages and command messages come to the same port.
  148.  *
  149.  * Older programs have no broker port, so processing loops which
  150.  * make assumptions about type won't encounter the new message types.
  151.  *
  152.  * The TypeFilter CxObject is hereby obsolete.
  153.  *
  154.  * It is less convenient for the application, but eliminates testing
  155.  * for type of input messages.
  156.  */
  157.  
  158. /**********************************************************/
  159. /** CxObj Error Flags (return values from CxObjError())  **/
  160. /**********************************************************/
  161. #define COERR_ISNULL       1  /* you called CxError(NULL)         */
  162. #define COERR_NULLATTACH   2  /* someone attached NULL to my list    */
  163. #define COERR_BADFILTER    4  /* a bad filter description was given  */
  164. #define COERR_BADTYPE       8  /* unmatched type-specific operation   */
  165.  
  166.  
  167. /******************************/
  168. /* Input Expression structure */
  169. /******************************/
  170.  
  171. #define IX_VERSION   2
  172.  
  173. struct InputXpression {
  174.    UBYTE   ix_Version;       /* must be set to IX_VERSION  */
  175.    UBYTE   ix_Class;       /* class must match exactly     */
  176.  
  177.    UWORD   ix_Code;       /* Bits that we want     */
  178.  
  179.    UWORD   ix_CodeMask;    /* Set bits here to indicate  */
  180.                /* which bits in ix_Code are  */
  181.                            /* don't care bits.         */
  182.  
  183.    UWORD   ix_Qualifier;   /* Bits that we want     */
  184.  
  185.    UWORD   ix_QualMask;    /* Set bits here to indicate  */
  186.                /* which bits in ix_Qualifier */
  187.                            /* are don't care bits     */
  188.  
  189.    UWORD   ix_QualSame;    /* synonyms in qualifier     */
  190.    };
  191.  
  192. typedef struct InputXpression IX;
  193.  
  194. /* QualSame identifiers */
  195. #define IXSYM_SHIFT  1       /* left- and right- shift are equivalent    */
  196. #define IXSYM_CAPS   2       /* either shift or caps lock are equivalent    */
  197. #define IXSYM_ALT    4       /* left- and right- alt are equivalent    */
  198.  
  199. /* corresponding QualSame masks */
  200. #define IXSYM_SHIFTMASK (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
  201. #define IXSYM_CAPSMASK    (IXSYM_SHIFTMASK    | IEQUALIFIER_CAPSLOCK)
  202. #define IXSYM_ALTMASK    (IEQUALIFIER_LALT   | IEQUALIFIER_RALT)
  203.  
  204. #define IX_NORMALQUALS    0x7FFF;/* for QualMask field: avoid RELATIVEMOUSE */
  205.  
  206. /* matches nothing   */
  207. #define NULL_IX(I)   ((I)->ix_Class == IECLASS_NULL)
  208.  
  209. #endif
  210.